/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Optional;

/**
 * <p>Project: jse2204 - Op2
 * <p>Powered by webrx On 2022-09-28 17:30:52
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Op2 {
    public static void main(String[] args) {


        Optional<String> a = Optional.empty();
        Optional<String> b = Optional.ofNullable(null);
        Optional<String> c = Optional.of("java");

        System.out.println(a.orElse("空"));
        System.out.println(b.orElse("空"));
        System.out.println(c.orElse("空"));

        Integer x = null;
        if(x !=null && x instanceof Integer) {
            System.out.println(x.intValue());
        }else{
            System.out.println(0);
        }

        Optional<Integer> oo = Optional.of(10);

        if(oo.isPresent()) {
            System.out.println(oo.get());
            System.out.println(oo.orElse(0));
        }

        Integer y = 5;
        System.out.println(y.intValue());

    }
}
